package com.jzo2o.market.controller.consumer;

import com.jzo2o.market.model.dto.request.SeizeCouponReqDTO;
import com.jzo2o.market.model.dto.response.CouponInfoResDTO;
import com.jzo2o.market.service.ICouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户端优惠券
 *
 * @Author wangxinyi
 * @Date 2024/12/15 21:02
 */
@RestController
@RequestMapping("/consumer/coupon")
@Api(tags = "用户端优惠券相关接口")
public class CouponController {

    @Autowired
    private ICouponService couponService;

    @GetMapping("/my")
    @ApiOperation("我的优惠券")
    public List<CouponInfoResDTO> selectMy(Integer status, Integer lastId) {
        return couponService.selectMy(status, lastId);
    }


    /**
     * 抢券接口
     *
     * @param seizeCouponReqDTO
     */
    @PostMapping("/seize")
    @ApiOperation("抢券")
    public void seizeCoupon(@RequestBody SeizeCouponReqDTO seizeCouponReqDTO) {
        couponService.seizeCoupon(seizeCouponReqDTO);
    }
}
